using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;

using Clandestine.Graphics;
using Lime;

namespace Clandestine.Engines.Field.Collision
{
	public partial class Hull
	{
		private static Sprite render(RenderList rl, Rectangle bbox, List<Point> points)
		{
			Bitmap bmp = new Bitmap(bbox.Width, bbox.Height);
			
			List<Point> untranslatedPoints = new List<Point>();
			
			foreach (Point p in points)
				untranslatedPoints.Add(new Point(p.X - bbox.Left, p.Y - bbox.Top));
			
			System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);
			g.DrawLines(Pens.White, untranslatedPoints.ToArray());
			g.FillPolygon(new SolidBrush(Color.FromArgb(164, 255, 255, 255)), untranslatedPoints.ToArray());
			g.Flush(FlushIntention.Sync);
			
			Sprite sp = new Sprite(rl, bmp);
			sp.Transform.X = bbox.Left;
			sp.Transform.Y = bbox.Top;
			sp.Color = new Color4(0f, 1f, 1f, 1f);
			return sp;
		}
	}
}
